﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class CotPlanVueloCliente : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DropDownCiudad.Attributes.Add("style", "display:none");
        AnalisaestadoCheck();
        AnalisaUrgencia();
        if (!Page.IsPostBack)
        {

            DataTable myTabla = new DataTable();
            myTabla.Columns.Add(new DataColumn("CodigoCiudadOrigen", typeof(System.Int32)));
            myTabla.Columns.Add(new DataColumn("CodigoCiudadDestino", typeof(System.Int32)));
            myTabla.Columns.Add(new DataColumn("Fecha", typeof(System.DateTime)));
            myTabla.Columns.Add(new DataColumn("CodigoHorario", typeof(System.Int32)));
            myTabla.Columns.Add(new DataColumn("CodigoRadio", typeof(System.Int32)));

            myTabla.Rows.Add(new object[5] { -1, -1, null, -1, -1 });
            RadGrid1.DataSource = myTabla;

            ViewState["myTabla"] = myTabla;
            RadGrid1.DataBind();

            //List<MOTIVO_RECHAZO_GASCO> myLista = MOTIVO_RECHAZO_GASCOAccessor.CreateInstance().SelectAll();
            //DropDownCiudad.DataSource = myLista;
            //DropDownCiudad.DataValueField = "IdMotivoRechazo";
            //DropDownCiudad.DataTextField = "MotivoRechazo";
            //DropDownCiudad.DataBind();

        }
    }
    protected void cHKMultiplesDestinos_CheckedChanged(object sender, EventArgs e)
    {
        AnalisaestadoCheck();
    }

    private void AnalisaestadoCheck()
    {
        if (!cHKMultiplesDestinos.Checked)
        {
            btnAddDestino.Attributes.Add("style", "display:none");
            btnEliminarDestino.Attributes.Add("style", "display:none");
        }
        else
        {
            btnAddDestino.Attributes.Add("style", "display:true");
            btnEliminarDestino.Attributes.Add("style", "display:true");
     
        }
    
    }


    private void AnalisaUrgencia()
    {
        if (RbNormal.Checked)
        {
            btnPasajeros.Attributes.Add("style", "display:none");
        }
        else
        {
            btnPasajeros.Attributes.Add("style", "display:true");
        }
   }

    protected void btnAddDestino_Click(object sender, EventArgs e)
    {
        DataTable myTabla = new DataTable();
        myTabla = (DataTable)ViewState["myTabla"];
        myTabla.Rows.Add(new object[5] { -1, -1, null, -1, -1 });
        RadGrid1.DataSource = myTabla;

        ViewState["myTabla"] = myTabla;
        RadGrid1.DataBind();
    }
    protected void RbNormal_CheckedChanged(object sender, EventArgs e)
    {
        AnalisaUrgencia();
    }
    protected void btnPasajeros_Click(object sender, EventArgs e)
    {

    }
}
